[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 strrev()                Reverse Characters in String

 #include   <string.h>                   Required for declarations only

 char       *strrev(string);
 char       *string;                     String to be reversed

    strrev() reverses the order of the characters in 'string'.  The
    terminating null character ('\0') remains at the end.

       Returns:     A pointer to the reversed string.  There is no error
                    return.

   -------------------------------- Example ---------------------------------

    The following statements make a copy of 'string' (using strdup()),
    reverse the copy, then print out both the original and the copy.

           #include <string.h>
           #include <stdio.h>

           char string[27] = "abcdefghijklmnopqrstuvwxyz";
           char *rev;

           main()
           {
               rev = strrev(strdup(string));
               printf("original: %s\nreversal: %s\n",string,rev);
           }


See Also: strcpy() strset()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson